home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / DD3BETA1.ZIP / PACK1.PRG / TMP / DD3DROP.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-01-15  |  2.5 KB  |  134 lines

  1. Unit dd3drop;
  2.  
  3. Interface
  4.  
  5.     Uses dd3str;
  6.     Function DropString(line : word) : String;
  7.         Function DropBoolean(line : word) : boolean;
  8.         function DropInteger(line : word) : longint;
  9.         procedure ReadDrop(filename : string);
  10.         procedure deletedroplist;
  11.  
  12. Implementation
  13.  
  14. Type
  15.     ListPtr = ^List;
  16.     List = Record
  17.         Value : String[80];
  18.         Next : ListPtr;
  19.  
  20.     End;
  21. var
  22.  
  23.         listhead : listptr;
  24.  
  25. Function DropString( line : word ) : String;
  26. Var
  27.     N : ListPtr;
  28.         cnt: word;
  29. Begin
  30.     N   := ListHead;
  31.         cnt := 1;
  32.     While( N <> nil ) Do
  33.     Begin
  34.         If line = cnt Then
  35.         Begin
  36.             DropString := N^.Value;
  37.             Exit;
  38.         End;
  39.         N := N^.Next;
  40.                 inc(cnt);
  41.     End;
  42.     DropString := '';
  43. End;
  44.  
  45. Function DropInteger( line : word ) : LongInt;
  46. Var
  47.     V : LongInt;
  48. Begin
  49.     V := Str_To_Int(DropString(line));
  50.     If V = -1 then V := 0;
  51.     DropInteger := V;
  52. End;
  53.  
  54. Function DropBoolean( line : word) : Boolean;
  55. Var
  56.     S : String;
  57.     I : LongInt;
  58. Begin
  59.     S := dropString( line );
  60.     I := dropInteger( line );
  61.     S := Upper(S);
  62.     dropBoolean := false;
  63.     If( S = 'YES' ) Then dropBoolean := True;
  64.     If( S = 'Y' ) Then dropBoolean := True;
  65.     If( S = 'TRUE' ) Then dropBoolean := True;
  66.     If( S = 'T' ) Then dropBoolean := True;
  67.     If( S = 'ON' ) Then dropBoolean := True;
  68.         If( S = 'GR' ) then dropboolean := True;
  69.     If( I > 0 ) Then dropBoolean := True;
  70.     If( S = 'NO' ) Then dropBoolean := False;
  71.     If( S = 'N' ) Then dropBoolean := False;
  72.     If( S = 'FALSE' ) Then dropBoolean := False;
  73.     If( S = 'F' ) Then dropBoolean := False;
  74.     If( S = 'OFF' ) Then dropBoolean := False;
  75. End;
  76.  
  77. procedure additem(temp : string);
  78. var
  79.  SPF,SPF1 : listptr;
  80. begin
  81.   new(SPF);
  82.   SPF^.value := temp;
  83.   SPF^.next := nil;
  84.  if listhead = nil then listhead := SPF
  85.    else begin
  86.         SPF1 := listhead;
  87.         while SPF1^.next <> nil do
  88.           SPF1 := SPF1^.next;
  89.           SPF1^.next := SPF;
  90.    end; {else}
  91. end;
  92.  
  93. procedure deletedroplist;
  94. var
  95. s,s1 : listptr;
  96. begin
  97. s := listhead;
  98. While s <> Nil Do
  99.         Begin
  100.             s1 := s;
  101.             s := s^.Next;
  102.             Dispose(s1);
  103.         End;
  104. listhead := nil;
  105. end;
  106.  
  107.  
  108. Procedure ReadDrop(filename : string);
  109. Var
  110.     F : Text;
  111.     S : String;
  112.     N : Listptr;
  113.     I : Integer;
  114.     C : Char;
  115. Begin
  116.     If ListHead <> nil then Exit;
  117.  
  118.     Assign( F,  filename);
  119.     {$I-} Reset( F ); {$I+}
  120.     If IOResult <> 0 Then Exit;
  121.  
  122.     While Not EOF( F ) do
  123.     Begin
  124.         Readln( F, S );
  125.                 additem(s);
  126.     End;
  127.  
  128.     Close( F );
  129. End;
  130.  
  131. Begin
  132.     ListHead := nil;
  133. End.
  134.